package com.hejx.security.common.bean;

import com.hejx.security.common.enums.ResultEnum;

/**
 * AJAX返回的对象实体
 *
 * @author hejx
 * @email doubihah@foxmail.com
 * @create 2017-05-27 20:42
 **/
public class Result<T> {

    private Integer code;   //0:成功 1:失败
    private String msg;     //提示信息
    private T data; //具体的内容

    public Result() {
    }

    public Result(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Result(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Result(ResultEnum resultEnum) {
        this.code = resultEnum.getCode();
        this.msg = resultEnum.getMsg();
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
